const UserModel = require('../schema/user');


class userModel {
    /**
     * 创建用户模型
     * @param data
     * @returns {Promise<*>}
     */
     static async create(data){
         let { nickname, username, avator, password, mobile } = data;
        return await UserModel.create({
            username,
            nickname,
            avator,
            password,
            mobile
        });
    }

    /**
     * 查询用户的详情
     * @param id 用户ID
     * @returns {Promise<Model>}
     */
    static async UserInfo(id){
        return await UserModel.findOne({
            where:{
                id
            }
        });
    }
}

module.exports = userModel;